/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package locusts.common.net;

import java.io.Serializable;
import locusts.common.Player;

/**
 *
 * @author hamish
 */
public class PlayerMessage implements Serializable {

    private PlayerMessage() {
        
    }
    public static class NewPlayerRequest extends PlayerMessage {

        private final String localId;

        public NewPlayerRequest(String localId) {
            this.localId = localId;
        }

        public String getLocalId() {
            return localId;
        }


    }

    public static class NewPlayerResponse extends NewPlayerRequest {

        private final Player player;
        public NewPlayerResponse(String localId, Player player) {
            super(localId);
            this.player = player;

        }

        public Player getPlayer() {
            return player;
        }

    }

    public static class PlayerDetailsUpdate extends PlayerMessage {

        private final Player player;
        
        public PlayerDetailsUpdate(Player player) {
            this.player = player;
        }

        public Player getPlayer() {
            return player;
        }


        public void applyTo(Player that) {

            that.setKills(player.getKills());
            that.setDamage(player.getDamage());
            that.setTime(player.getTime());
            that.setName(player.getName());
            that.setFarmId(player.getFarmId());
        }
    }
}
